﻿using Abp.Application.Services;
using App.Authorization.Roles.Dto;
using App.Authorization.Users.Dto;
using App.BaseObject;
using App.Configuration;
using App.MultiTenancy;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace App.Authorization.Users
{
    public interface IUserAppService : IApplicationService
    {
        /// <summary>
        /// 创建用户
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<User> CreateUser(UserDto dto);

        /// <summary>
        /// 修改用户
        /// </summary>
        /// <param name="id"></param>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task UpdateUser(long id, UserDto dto);

        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task ChangeUserPassword(ChangePwdDto dto);

        /// <summary>
        /// 登录日志
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        Task<long> GetLoginCount(long userId);

        /// <summary>
        /// 根据用户名获取用户信息
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        Task<User> GetUserByUserNameAsync(string userName);

        /// <summary>
        /// 获取用户
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        Task<User> GetUserById(long userId);

        /// <summary>
        /// 保存用户所对应的按钮
        /// </summary>
        /// <param name="id"></param>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task SaveUserButtons(int id, BulkKeyDto<int> dto);

        /// <summary>
        /// 获取指定用户的所有权限
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        Task<List<MenuPermission>> GetAllMenuByUserId(long userId);

        /// <summary>
        /// 根据时间范围获取日程数据
        /// </summary>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <returns></returns>
        Task<List<CalendarEvent>> GetCalendarEvents(DateTime start, DateTime end);
        /// <summary>
        /// 更新日程
        /// </summary>
        /// <param name="id"></param>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task UpdateCalendarEvent(int id, CalendarEventDto dto);
        /// <summary>
        /// 创建日程
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task CreateCalendarEvent(CalendarEventDto dto);
        /// <summary>
        /// 删除日程
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task DeleteCalendarEventAsync(int id);
    }
}
